
int buttonPin = 12;
int ledPin =  13;     
long countDownTime = 5000; // [milli seconds]
unsigned long currentTime;
unsigned long timeAtStart;
boolean startupProcedure = true;
boolean firstTime = true;

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);   
  digitalWrite(ledPin, HIGH); //start with the led on
  digitalWrite(buttonPin, HIGH); // turn on pullup resistors 
}

void loop()
{
  if(startupProcedure && (digitalRead(buttonPin)==HIGH))
  {
    if(firstTime)
    {
      timeAtStart = millis(); //get time at startup
      firstTime = false;
    }
    digitalWrite(ledPin, LOW);
    if(millis()>timeAtStart+countDownTime){
     digitalWrite(ledPin, HIGH); //countdown over, you can start!
     startupProcedure = false; //you don't have to count down after this 
    }
  }else if(digitalRead(buttonPin)==HIGH)
  {
    //whatever you want to do
    digitalWrite(ledPin, HIGH);   
    delay(1000);               
    digitalWrite(ledPin, LOW);    
    delay(1000);               
  }
}

